package com.jml.mybatis.demo;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;

public class MainTest {
	static SqlSessionFactory sqlSessionFactory = null;
	static {
		sqlSessionFactory = MybatisUtils.getSqlSessionFactory();
	}
	public static void main(String[] args) {
		SqlSession sqlSession = sqlSessionFactory.openSession();
		try {
			UserMapper userMapper = sqlSession.getMapper(UserMapper.class);
			User user = new User("jml",100);
			userMapper.insertUser(user);
			sqlSession.commit();
		} finally {
			sqlSession.close();
		}
	}
}
